//
//  TeamAndTitleTableViewCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//


//近期战绩
#import "TeamAndTitleTableViewCell.h"

#import "PassVCScoreViewCell.h"


@interface TeamAndTitleTableViewCell ()


@property(nonatomic,strong)UIImageView *teamView;

@property(nonatomic,strong)UIView *totalView;

@property(nonatomic,strong)UIView *titleView;



/** 日期 */
@property(nonatomic,strong)UILabel*dateLabel;

/** 赛事 */
@property(nonatomic,strong)UILabel*leagueNameLabel;

/** 主队 */
@property(nonatomic,strong)UILabel*homeTeamLabel;

/** 比分 */
@property(nonatomic,strong)UILabel*scoreLabel;

/** 客队 */
@property(nonatomic,strong)UILabel*awayTeamLabel;




@end

@implementation TeamAndTitleTableViewCell



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        float partX = kScreenIp6(20);
        float partHeight = 35;
        
        
        self.teamView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth,partHeight)];
        self.teamView.image = [UIImage imageNamed:@"header_view_bg"];
        
        [self.contentView addSubview:_teamView];
        
        
        //线
        UIView *lineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, 0, kScreenWidth, 0.5)];
        
        lineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        [self.contentView addSubview:lineView];
        
        
        
        //球队
        self.teamName = [[UILabel alloc]initWithFrame:CGRectMake(partX, 0, kScreenWidth, partHeight)];
        self.teamName.font = [UIFont systemFontOfSize:14];
        
        [self.teamView addSubview:_teamName];
        
        
        
        /*
        // 统计
        self.totalView = [[UIView alloc] initWithFrame:CGRectMake(kScreenWidth - kScreenIp6(210), 0, kScreenIp6(210), partHeight)];
        [self.contentView addSubview:_totalView];
        
        
        self.total = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kScreenIp6(50), partHeight)];
        self.total.textAlignment = NSTextAlignmentCenter;
        self.total.font = [UIFont systemFontOfSize:12];
        self.total.text = @"共10场";
        [self.totalView addSubview:_total];
        
        self.statistics = [[UILabel alloc ] initWithFrame:CGRectMake(CGRectGetMaxX(self.total.frame), 0, kScreenIp6(70), partHeight)];
        self.statistics.textAlignment = NSTextAlignmentCenter;
        self.statistics.font = [UIFont systemFontOfSize:12];
        self.statistics.text = @"8省2平0负";
        [self.totalView addSubview:_statistics];
        
        self.odds = [[UILabel alloc ] initWithFrame:CGRectMake(CGRectGetMaxX(self.statistics.frame), 0, kScreenIp6(70), partHeight)];
        self.odds.textAlignment = NSTextAlignmentCenter;
        self.odds.font = [UIFont systemFontOfSize:12];
        self.odds.text = @"胜率80%";
        [self.totalView addSubview:_odds];
        */
        
        
        
        // titleView
        self.titleView =[ [UIView alloc]initWithFrame:CGRectMake(0, partHeight, kScreenWidth, partHeight)];
        
        [self.contentView addSubview:_titleView];
        
        
        //开始高度
        float partY = 0;
        
        CGFloat dataWidth = kScreenIp6(80);
        CGFloat leagueWidth = kScreenIp6(60);
        CGFloat scoreWidth = kScreenIp6(50);
        
        CGFloat partWidth = ( kScreenWidth - dataWidth - leagueWidth - scoreWidth - kScreenIp6(10) ) / 2;
        
        
        
        //日期
        self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, partY, dataWidth, partHeight)];
        self.dateLabel.font = [UIFont systemFontOfSize:14];
        self.dateLabel.textAlignment = NSTextAlignmentCenter;
        self.dateLabel.text = @"日期";
        
        [self.titleView addSubview:_dateLabel];
        
        
        //赛事
        self.leagueNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.dateLabel.frame), partY, leagueWidth - kScreenIp6(10), partHeight)];
        self.leagueNameLabel.font = [UIFont systemFontOfSize:14];
        self.leagueNameLabel.textAlignment = NSTextAlignmentCenter;
        
        self.leagueNameLabel.text = @"赛事";
        
        [self.titleView addSubview:_leagueNameLabel];
        
        
        //主队
        self.homeTeamLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.leagueNameLabel.frame) + kScreenIp6(5), partY, partWidth, partHeight)];
        self.homeTeamLabel.font = [UIFont systemFontOfSize:14];
        self.homeTeamLabel.textAlignment = NSTextAlignmentCenter;
        
        self.homeTeamLabel.text = @"主队";
        [self.titleView addSubview:_homeTeamLabel];
        
        
        
        //比分
        self.scoreLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.homeTeamLabel.frame), partY, scoreWidth, partHeight)];
        self.scoreLabel.font = [UIFont systemFontOfSize:14];
        self.scoreLabel.textAlignment = NSTextAlignmentCenter;
        self.scoreLabel.text = @"比分";
        
        [self.titleView addSubview:_scoreLabel];
        
        
        
        //客队
        self.awayTeamLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.scoreLabel.frame), partY, partWidth, partHeight)];
        self.awayTeamLabel.font = [UIFont systemFontOfSize:14];
        self.awayTeamLabel.textAlignment = NSTextAlignmentCenter;
        self.awayTeamLabel.text = @"客队";
        
        [self.titleView addSubview:_awayTeamLabel];
        
        
        
        
        //线
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, partHeight, kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        [self.titleView addSubview:footLineView];
        
        
        
        // 设置 cell 点击没有变化
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        
        [self customTextColor];
        
        

        
    }
    
    
    return self;
    
}


- (void)customTextColor
{
    self.dateLabel.textColor = [UIColor grayColor];
    self.leagueNameLabel.textColor = [UIColor grayColor];
    self.homeTeamLabel.textColor = [UIColor grayColor];
    self.scoreLabel.textColor = [UIColor grayColor];
    self.awayTeamLabel.textColor = [UIColor grayColor];
}




@end
